package com.software.modelcenter.repository;

import com.software.modelcenter.entity.Collection;
import com.software.modelcenter.entity.ModelInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Repository
public interface CollectionRepository extends JpaRepository<Collection, String> {
    Collection findCollectionByModelId(String modelId);
    Collection findCollectionByUserIdAndModelId(String userId, String modelId);

    @Query(value = "select * from collection where user_id=?1",nativeQuery = true)
    List<Collection> findAllByUserId(String userId);


}
